package com.hrp.hrpdao;

import com.hrp.domain.Jxkhzq;
import com.hrp.domain.Jxksdmk;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created by Administrator on 2018/8/10 0010.
 */
@Mapper
public interface JxksdmkDao {


    @Select("select count(*) total from JX_KSDMK")
    Integer getTotalCount();

    @Select("<script>"
            + " select * from (select id,jxksdm,jxksmc,py,wb,tybz,kslb, Row_Number() OVER (ORDER BY id) row from JX_KSDMK where kslb in"
            + "<foreach item='item' index='index' collection='kslbList' open='(' separator=',' close=')'>"
            + "#{item}"
            + "</foreach>"
            + " ) T  where row in "
            + "<foreach item='item' index='index' collection='strList' open='(' separator=',' close=')'>"
            + "#{item}"
            + "</foreach>"
            + "</script>")
    List<Jxksdmk> getJxksdmByPage(@Param("kslbList") List<Integer> kslbList,@Param("strList") List<Integer> strList);



    @Select("select * from JX_KSDMK")
    List<Jxksdmk> getAllJxksList();

    @Select(" select MAX(jxksdm) jxksdm from JX_KSDMK where kslb=#{kslb} ")
    String getJxksdmByKslb(@Param("kslb") Integer kslb);

    @Insert(" insert into JX_KSDMK (jxksdm,jxksmc,py,tybz,kslb) values(#{jxksdm},#{jxksmc},#{py},#{tybz},#{kslb}) ")
    void saveJxksData(Jxksdmk jxksdmk);

    @Insert(" update JX_KSDMK set jxksmc=#{jxksmc} ,py=#{py},tybz=#{tybz} where jxksdm=#{jxksdm} ")
    void updateJxksData(Jxksdmk jxksdmk);

    @Select(" select *  from JX_KSDMK where jxksdm=#{jxksdm} ")
    Jxksdmk getJxksdmByJxksdm(@Param("jxksdm") String jxksdm);
}
